﻿using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Blogs
{
    class DbHelper
    {
        public static readonly string info = "server =DESKTOP - 1D8K52G\\SQLEXPRESS; database = Blogs; uid = sa; pwd = DWYRYJZ1313323/";
        
        public static DataTable GetDate(string sql)
        {
            SqlConnection connection = new SqlConnection(info);
            SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, connection);
            DataTable dt = new DataTable();
            connection.Open();
            dataAdapter.Fill(dt);
            return dt;

        }
        public static int Delete(string sql)
        {
            SqlConnection connection = new SqlConnection(info);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            return command.ExecuteNonQuery();
        }
    }
}
